﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp
{

    public class @enum
    {
        public enum RangeType
        {
            Auto,
            uA1,
            uA10,
            uA100,
            mA1,
            mA10,
            mA100,
            A1,
            A3
        }
        
        static void Main1()
        {
            int index = 0;
            Dictionary<RangeType, int> DataAddresses = new()
            {
                { RangeType.uA10, 0},
                { RangeType.uA100, 0x20},
                { RangeType.mA1 , 0x40},
                { RangeType.mA10, 0x60},
                { RangeType.mA100, 0x80},
                { RangeType.A1, 0xA0},
            };

            /*var dic = DataAddresses.ToList();
            foreach (var address in dic)
            {
                Console.WriteLine($"Key:{address.Key}, Value:{address.Value}");
                //Console.WriteLine(dic[index].Value);
                index++;
            }*/
            /*RangeType[] keys = new RangeType[DataAddresses.Count];
            DataAddresses.Keys.CopyTo(keys, 0);
            while (index <keys.Length)
            {
                RangeType key = keys[index];
                int value = DataAddresses[key];
                Console.WriteLine($"Key:{key}, Value:{value}");
                index++;
            }*/
            var enumerator = DataAddresses.GetEnumerator();
            while (enumerator.MoveNext()) 
            {
                var pair = enumerator.Current;
                Console.WriteLine($"Key:{pair.Key}, Value{pair.Value}");
            }
            enumerator.Dispose();
        }
    }
}
